DataSource for Entity Framework in WPF
C1.LiveLinq.Indexing Namespace / Subindex<T,TKey> Class
The type of the elements of the collection to index.
The type of the index key.
Members

In This Topic
    Subindex<T,TKey> Class
    In This Topic
    Defines a subindex, an index definition subordinate to another index definition, its parent.
    Object Model
    Subindex<T,TKey> Class
    Syntax
    'Declaration
     
    Public MustInherit Class Subindex
        (Of T,TKey) 
       Inherits Subindex(Of T)
    public abstract class Subindex<T,TKey> : Subindex<T> 
    Type Parameters
    T
    The type of the elements of the collection to index.
    TKey
    The type of the index key.
    Remarks

    An index (Index<T,TKey>) can have subindexes. Subindexes are optional, not required for any indexing tasks, but can provide additional optimization and help minimize memory requirements when a collection is indexed by multi-level (multi-field) keys.

    Suppose we want to index a Customers table by two fields, (City, Rating), perhaps for speeding up queries like from c in Customers where c.City == "London" && c.Rating == 1 select c We can do it by defining an index with key selector c => new { c.City, c.Rating } , that will index the table by two fields, creating a multi-field index. Such index will suffice for optimizing the query above, but it will not optimize, for example, the following query: from c in Customers where c.City == "London" && c.Rating > 2 select c Also, multi-field indexes occupy more memory than necessary because they have to store repeated field values.

    Subindexes provide a better alternative for optimizing multi-field searches. In the example above, we can define an index by City and create a subindex of that index, by Rating. Using subindexes becomes even more effective when, as it is often happens, we also need queries to search by additional fields, like, for example, if we need to search by ContactTitle inside a city in addition to the search by Rating inside a city: from c in Customers where c.City == "London" && c.ContactTitle == "Owner" select c All we have to do now is to add a second subindex to the index by City, a subindex by ContactTitle.

    Inheritance Hierarchy

    System.Object
       C1.LiveLinq.Indexing.IndexDefinition<T>
          C1.LiveLinq.Indexing.Subindex<T>
             C1.LiveLinq.Indexing.Subindex<T,TKey>

    See Also